
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    {load file='/static/css/bootstrap.css'}
    {load file='/static/css/all.css'}
    {load file='/static/css/style.css'}
    {load file='/static/js/jquery-3.4.1.min.js'}
    {load file='/static/js/popper.js'}
    <!--<script src="https://cdn.staticfile.net/popper.js/1.15.0/umd/popper.min.js"></script>-->
    {load file='/static/js/bootstrap.js'}
    {load file='/static/js/bootbox.js'}
    <style type="text/css">
        body{background-color: rgba(250, 250, 240, 0.7)}
    </style>
</head>
<body>
<div>
    <form action="" id="reserveForm">
        <input type="hidden" id="num" name="num">
        <div class="form-group">
            <div class="row">
                <div class="col-sm-6">
                    <label for="id">id：</label>
                    <input type="text" class="form-control" id="id" name="patientid" value="{$rid}" required="required" readonly>
                </div>
                <div class="col-sm-6">
                    <label for="name">姓名：</label>
                    <input type="text" class="form-control" id="name" name="patientname" value="{$rname}" required="required">
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <label for="sex">性别：</label>
                    <input type="text" class="form-control" id="sex" name="sex" required="required">
                </div>
                <div class="col-sm-6">
                    <label for="age">年龄：</label>
                    <input type="text" class="form-control" id="age" name="age" required="required">
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <label for="time">时间：</label>
                    <input type="text" class="form-control" id="time" name="rtime" value="{$time}" required="required">
                </div>
                <div class="col-sm-6">
                    <label for="ys">选择医生：</label>
                    <select name="doctorname" id="ys" class="form-control" required="required">

                        {foreach $m3 as $v3}
                        <option value="{$v3.doctorname}">{$v3.doctorname}-{$v3.major}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <label for="phone">手机号：</label>
                    <input type="text" class="form-control" id="phone" name="phone" maxlength="11" required="required">
                </div>
                <div class="col-sm-6">
                    <label for="ks">选择科室：</label>
                    <select name="subjectname" id="ks" class="form-control" required="required">
                        {foreach $m4 as $v3}
                        <option value="{$v3.subjectname}">{$v3.subjectname}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-12">
                    <label for="st">病情描述：</label>
                    <textarea class="form-control" rows="2" id="st" name="patientstate" required="required"></textarea>
                </div>
            </div>
        </div>
    </form>
    <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="add()">保存</button>
</div>
</body>
</html>
<script>
    function add(){
        $.post("/index.php/hospital/index/add",$("#reserveForm").serialize(),function(res){
            if(res>0){
                bootbox.alert("添加成功",function(){
                    window.location.reload();
                    // window.location.href = '/index.php/hospital/subject/list';
                });
            }else{
                bootbox.alert("添加失败");
            }

        })

    }
</script>

